package com.lyy.lottery.common.exception;

import com.lyy.lottery.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException{
    private Integer code;//业务错误码
    private String message;

    //序列化需要一个无参构造函数
    public ControllerException() {

    }

    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMsg();
    }
    public ControllerException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

}
